package com.swe.chums.dao.example;

import java.math.*;
import java.util.Date;
import java.util.List;
import com.swe.chums.dao.WebResourceDao;
import com.swe.chums.dao.model.WebResource;
import com.swe.chums.dao.exceptions.WebResourceDaoException;
import com.swe.chums.dao.factory.DaoFactory;

public class WebResourceDaoExample
{
	/**
	 * Method 'main'
	 * 
	 * @param arg
	 * @throws Exception
	 */
	public static void main(String[] arg) throws Exception
	{
		// Uncomment one of the lines below to test the generated code
		
		// findAll();
		// findByWebResourceType(0);
		// findWhereIdEquals(0);
		// findWhereWebResourceTypeIdEquals(0);
		// findWhereUrlHashIdEquals(0);
		// findWhereUrlEquals("");
		// findWhereTitleEquals("");
		// findWhereDescriptionEquals("");
		// findWhereThumbnailFileNameEquals("");
		// findWhereAverageRatingEquals("");
	}

	/**
	 * Method 'findAll'
	 * 
	 * @throws Exception
	 */
	public static void findAll() throws Exception
	{
		WebResourceDao dao = DaoFactory.createWebResourceDao();
		List<WebResource> _result = dao.findAll();
		for (WebResource dto : _result) {
			display(dto);
		}
		
	}

	/**
	 * Method 'findByWebResourceType'
	 * 
	 * @param webResourceTypeId
	 * @throws Exception
	 */
	public static void findByWebResourceType(int webResourceTypeId) throws Exception
	{
		WebResourceDao dao = DaoFactory.createWebResourceDao();
		List<WebResource> _result = dao.findByWebResourceType(webResourceTypeId);
		for (WebResource dto : _result) {
			display(dto);
		}
		
	}

	/**
	 * Method 'findWhereIdEquals'
	 * 
	 * @param id
	 * @throws Exception
	 */
	public static void findWhereIdEquals(int id) throws Exception
	{
		WebResourceDao dao = DaoFactory.createWebResourceDao();
		List<WebResource> _result = dao.findWhereIdEquals(id);
		for (WebResource dto : _result) {
			display(dto);
		}
		
	}

	/**
	 * Method 'findWhereWebResourceTypeIdEquals'
	 * 
	 * @param webResourceTypeId
	 * @throws Exception
	 */
	public static void findWhereWebResourceTypeIdEquals(int webResourceTypeId) throws Exception
	{
		WebResourceDao dao = DaoFactory.createWebResourceDao();
		List<WebResource> _result = dao.findWhereWebResourceTypeIdEquals(webResourceTypeId);
		for (WebResource dto : _result) {
			display(dto);
		}
		
	}

	/**
	 * Method 'findWhereUrlHashIdEquals'
	 * 
	 * @param urlHashId
	 * @throws Exception
	 */
	public static void findWhereUrlHashIdEquals(int urlHashId) throws Exception
	{
		WebResourceDao dao = DaoFactory.createWebResourceDao();
		List<WebResource> _result = dao.findWhereUrlHashIdEquals(urlHashId);
		for (WebResource dto : _result) {
			display(dto);
		}
		
	}

	/**
	 * Method 'findWhereUrlEquals'
	 * 
	 * @param url
	 * @throws Exception
	 */
	public static void findWhereUrlEquals(String url) throws Exception
	{
		WebResourceDao dao = DaoFactory.createWebResourceDao();
		List<WebResource> _result = dao.findWhereUrlEquals(url);
		for (WebResource dto : _result) {
			display(dto);
		}
		
	}

	/**
	 * Method 'findWhereTitleEquals'
	 * 
	 * @param title
	 * @throws Exception
	 */
	public static void findWhereTitleEquals(String title) throws Exception
	{
		WebResourceDao dao = DaoFactory.createWebResourceDao();
		List<WebResource> _result = dao.findWhereTitleEquals(title);
		for (WebResource dto : _result) {
			display(dto);
		}
		
	}

	/**
	 * Method 'findWhereDescriptionEquals'
	 * 
	 * @param description
	 * @throws Exception
	 */
	public static void findWhereDescriptionEquals(String description) throws Exception
	{
		WebResourceDao dao = DaoFactory.createWebResourceDao();
		List<WebResource> _result = dao.findWhereDescriptionEquals(description);
		for (WebResource dto : _result) {
			display(dto);
		}
		
	}

	/**
	 * Method 'findWhereThumbnailFileNameEquals'
	 * 
	 * @param thumbnailFileName
	 * @throws Exception
	 */
	public static void findWhereThumbnailFileNameEquals(String thumbnailFileName) throws Exception
	{
		WebResourceDao dao = DaoFactory.createWebResourceDao();
		List<WebResource> _result = dao.findWhereThumbnailFileNameEquals(thumbnailFileName);
		for (WebResource dto : _result) {
			display(dto);
		}
		
	}

	/**
	 * Method 'findWhereAverageRatingEquals'
	 * 
	 * @param averageRating
	 * @throws Exception
	 */
	public static void findWhereAverageRatingEquals(String averageRating) throws Exception
	{
		WebResourceDao dao = DaoFactory.createWebResourceDao();
		List<WebResource> _result = dao.findWhereAverageRatingEquals(averageRating);
		for (WebResource dto : _result) {
			display(dto);
		}
		
	}

	/**
	 * Method 'display'
	 * 
	 * @param dto
	 */
	public static void display(WebResource dto)
	{
		StringBuffer buf = new StringBuffer();
		buf.append( dto.getId() );
		buf.append( ", " );
		buf.append( dto.getWebResourceTypeId() );
		buf.append( ", " );
		buf.append( dto.getUrlHashId() );
		buf.append( ", " );
		buf.append( dto.getUrl() );
		buf.append( ", " );
		buf.append( dto.getTitle() );
		buf.append( ", " );
		buf.append( dto.getDescription() );
		buf.append( ", " );
		buf.append( dto.getThumbnailFileName() );
		buf.append( ", " );
		buf.append( dto.getAverageRating() );
		System.out.println( buf.toString() );
	}

}
